package com.diandiansong.app.entity;

import com.google.gson.annotations.SerializedName;

import java.util.List;

import diandiansong.library.utils.BaseEntity;

public class CommodityInfoInfoSearch extends BaseEntity {


    /**
     * message : null
     * data : [{"commodity_id":"13","commodity_name":"生姜","imgs":"http://h3.mobilekoudai.com/uploads/2018-07-26/e8c378583de4034cc2d8e6da77d187cedd
     * .jpg","price":"0.01","unit":"斤","commodity_subtitle":"生姜水","stock":"100","spec_info":[{"product_id":"12","price":"0.01","store":"100",
     * "spec_info":"1斤，2斤，3斤，","kill_price":"0"}],"title_sku":"1斤，2斤，3斤，"}]
     */

    @SerializedName("data")
    private List<Data> data;

    public List<Data> getData() {
        return data;
    }

    public void setData(List<Data> data) {
        this.data = data;
    }

    public static class Data {
        /**
         * commodity_id : 13
         * commodity_name : 生姜
         * imgs : http://h3.mobilekoudai.com/uploads/2018-07-26/e8c378583de4034cc2d8e6da77d187cedd.jpg
         * price : 0.01
         * unit : 斤
         * commodity_subtitle : 生姜水
         * stock : 100
         * spec_info : [{"product_id":"12","price":"0.01","store":"100","spec_info":"1斤，2斤，3斤，","kill_price":"0"}]
         * title_sku : 1斤，2斤，3斤，
         */

        @SerializedName("cart_id")
        private String cart_id;
        @SerializedName("commodity_id")
        private String commodityId;
        @SerializedName("commodity_name")
        private String commodityName;
        @SerializedName("imgs")
        private String imgs;
        @SerializedName("price")
        private String price;
        @SerializedName("unit")
        private String unit;
        @SerializedName("commodity_subtitle")
        private String commoditySubtitle;
        @SerializedName("stock")
        private String stock;
        @SerializedName("sold")
        private String sold;
        @SerializedName("title_sku")
        private String titleSku;
        @SerializedName("spec_info")
        private String specInfo;


        @SerializedName("tourist")
        private String tourist;

        public boolean isTourist() {
            return tourist != null && tourist.equals("1");
        }

        public int getNum() {
            return num;
        }

        public void setNum(int num) {
            this.num = num;
        }

        int num = 1;

        public String getCommodityId() {
            return commodityId;
        }

        public void setCommodityId(String commodityId) {
            this.commodityId = commodityId;
        }

        public String getCommodityName() {
            return commodityName;
        }

        public void setCommodityName(String commodityName) {
            this.commodityName = commodityName;
        }

        public String getImgs() {
            return imgs;
        }

        public void setImgs(String imgs) {
            this.imgs = imgs;
        }

        public String getPrice() {
            if (isTourist()) {
                //return "--";
                return "";
            }
            return price;
        }

        public Float getPriceF() {
            try {
                return Float.valueOf(price);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return 1f;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public String getUnit() {
            return unit;
        }

        public void setUnit(String unit) {
            this.unit = unit;
        }

        public String getCommoditySubtitle() {
            return commoditySubtitle;
        }

        public void setCommoditySubtitle(String commoditySubtitle) {
            this.commoditySubtitle = commoditySubtitle;
        }

        public String getStock() {
            return stock;
        }

        public void setStock(String stock) {
            this.stock = stock;
        }

        public String getTitleSku() {
            return titleSku;
        }

        public void setTitleSku(String titleSku) {
            this.titleSku = titleSku;
        }

        public String getSpecInfo() {
            return specInfo;
        }

        public void setSpecInfo(String specInfo) {
            this.specInfo = specInfo;
        }

        public String getSold() {
            return sold;
        }

        public void setSold(String sold) {
            this.sold = sold;
        }

        public String getCart_id() {
            return cart_id;
        }

        public void setCart_id(String cart_id) {
            this.cart_id = cart_id;
        }

        public static class SpecInfo {
            /**
             * product_id : 12
             * price : 0.01
             * store : 100
             * spec_info : 1斤，2斤，3斤，
             * kill_price : 0
             */

            @SerializedName("product_id")
            private String productId;
            @SerializedName("price")
            private String price;
            @SerializedName("store")
            private String store;
            @SerializedName("spec_info")
            private String specInfo;
            @SerializedName("kill_price")
            private String killPrice;

            public String getProductId() {
                return productId;
            }

            public void setProductId(String productId) {
                this.productId = productId;
            }

            public String getPrice() {
                return price;
            }

            public void setPrice(String price) {
                this.price = price;
            }

            public String getStore() {
                return store;
            }

            public void setStore(String store) {
                this.store = store;
            }

            public String getSpecInfo() {
                return specInfo;
            }

            public void setSpecInfo(String specInfo) {
                this.specInfo = specInfo;
            }

            public String getKillPrice() {
                return killPrice;
            }

            public void setKillPrice(String killPrice) {
                this.killPrice = killPrice;
            }
        }
    }
}
